file object
This method will read a specified number of characters or bytes in a file.
string read(double count)
Parameters:
count
An optional number of characters/bytes to read. If this parameter is not passed or if it is set to 0, the remainder of the file will be read from the cursor.
Return value:
A string containing the retrieved data on success, or an empty string on failure.
Remarks:
If the file is opened in text mode, the number given in the count parameter specifies the number of characters that will be read. If, on the other hand, the file is opened as binary, then this parameter specifies the number of bytes instead.
Example:
// Read a file and display its content in an alert box.
void main()
{
file test;
test.open("test.txt", "r");
alert("test.txt contents", test.read());
}